<?php
/*
 * 测试观察者模式
 */

namespace App\Controller;

use App\DesignPattern\Observer\Event;
use App\DesignPattern\Observer\Observer1;
use App\DesignPattern\Observer\Observer2;
use App\DesignPattern\Observer\Observer3;

class ControllerObserver {

	public function actionIndex(){
	    $event = new Event();

	    //观察者订阅
	    $event->addObserver(new Observer1());
        $event->addObserver(new Observer2());
        $event->addObserver(new Observer3());

        $event->fire();
	}
}
